﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DONGACS.Assembler;
using DONGACS.DAO;
using DONGACS.Domain;
using DONGACS.DTO;

namespace DONGACS.SERVICE
{
    public class UsersInRolesService
    {
        UsersInRolesAssembler UsersInRolesAssembler = new UsersInRolesAssembler();
        UsersInRolesDao UsersInRolesDao = new UsersInRolesDao();


        public IList<UsersInRolesDto> GetUsersInRolesByUserId(string userId)
        {
            IList<UsersInRoles> usersInRolesList = UsersInRolesDao.GetUsersInRolesByUserId(userId);

            IList<UsersInRolesDto> usersInRolesDtoList = UsersInRolesAssembler.ConvertToDataTransferObjectList(usersInRolesList);

            return usersInRolesDtoList;
        }

        
        public IList<UsersInRolesDto> GetUsersInRolesByRoleId(string roleId)
        {
            IList<UsersInRoles> usersInRolesList = UsersInRolesDao.GetUsersInRolesByRoleId(roleId);
            IList<UsersInRolesDto> usersInRolesDtoList = UsersInRolesAssembler.ConvertToDataTransferObjectList(usersInRolesList);

            return usersInRolesDtoList;
        }

        public bool DeleteAllUserInRolesByUserId(string userId)
        {
            return UsersInRolesDao.DeleteAllUserInRolesByUserId(userId);
        }

        public IList<UsersInRolesDto> GetAllUsersInRoles()
        {
            return UsersInRolesAssembler.ConvertToDataTransferObjectList(UsersInRolesDao.GetAllUsersInRoles());
        }
    }
}
